const sequelize = require("./db");
const { DataTypes } = require("sequelize");

module.exports = sequelize.define(
  "User",
  {
    nickname: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    openid: {
      type: DataTypes.STRING(255),
      allowNull: false,
    },
    // session_key: {
    //   type: DataTypes.STRING(255),
    //   allowNull: true,
    // },
    avatarUrl: {
      type: DataTypes.STRING(255),
      allowNull: true,
    }
  },
  {
    createdAt: true,
    updatedAt: true,
    paranoid: true, //不会真正删除，而是增加一列deletedAt
  }
);
